package com.sg.bars.server.kernel.service;

import java.io.Serializable;

import com.sg.bars.client.kernel.action.Action;
import com.sg.bars.client.kernel.service.DataService;
import com.sg.bars.server.kernel.dao.JpaDao;

abstract public class AbstractActionQuery<T> implements Serializable{
	private static final long serialVersionUID = 1L;
	
	private Object userId; 
	private Action<T> action;
	private JpaDao jpaDao;
	private DataService dataService;
	private Object preResult;
	private TransactionalConfig transactionalConfig = TransactionalConfig.TRANSACTIONAL_REQUIRED;
	
	private AbstractActionQuery preActionQuery;
	private AbstractActionQuery postActionQuery;
	
	public Object getUserId() {
		return userId;
	}
	protected void setUserId(Object userId) {
		this.userId = userId;
	}
	public Action getAction() {
		return action;
	}
	protected void setAction(Action action) {
		this.action = action;
	}
	public JpaDao getJpaDao() {
		return jpaDao;
	}
	protected void setJpaDao(JpaDao jpaDao) {
		this.jpaDao = jpaDao;
	}
	public DataService getDataService() {
		return dataService;
	}
	protected void setDataService(DataService dataService) {
		this.dataService = dataService;
	}
	public void setPreActionQuery(AbstractActionQuery preActionQuery) {
		this.preActionQuery = preActionQuery;
	}
	public AbstractActionQuery getPreActionQuery() {
		return preActionQuery;
	} 
	public void setPostActionQuery(AbstractActionQuery postActionQuery) {
		this.postActionQuery = postActionQuery;
	}
	public AbstractActionQuery getPostActionQuery() {
		return postActionQuery;
	}
	protected void setPreResult(Object preResult) {
		this.preResult = preResult;
	}
	public Object getPreResult() {
		return preResult;
	}
	public void setTransactionalConfig(TransactionalConfig transactionalConfig) {
		this.transactionalConfig = transactionalConfig;
	}
	public TransactionalConfig getTransactionalConfig() {
		return transactionalConfig;
	}
	
	abstract public T processQuery();
	
}
